/*
 * @Author: chen haoxuan
 * @Date: 2021-06-13 23:07:05
 * @LastEditTime: 2021-06-13 23:20:18
 */
#include <iostream>
#include "Circle.cpp"
using namespace std;
class Cylinder : public Circle
{
public:
  Cylinder(float x = 0, float y = 0, float r = 0, float h = 0);
  void setHeight(float);
  float getHeight() { return height; }
  float area();
  float volume();
  friend ostream &operator<<(ostream &, Cylinder &);

protected:
  float height;
};
Cylinder::Cylinder(float x, float y, float r, float h) : Circle(x, y, r), height(h) {}

void Cylinder::setHeight(float h)
{
  height = h;
}

float Cylinder::area()
{
  return 2 * Circle::area() + 2 * 3.14159 * Circle::getRadius() * height;
}
float Cylinder::volume()
{
  return Circle::area() * height;
}
ostream &operator<<(ostream &output, Cylinder &cy)
{
  output << "Center=[" << cy.x << "," << cy.y << "],r=" << cy.Circle::getRadius() << ",h=" << cy.height << "\n area=" << cy.area() << ",volume=" << cy.volume() << endl;
  return output;
}